package com.eipc;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;

/**
 * common task��show a progress dailog on task start
 * @author x_liaolijun
 *
 */
public class CommonTask<T> extends AsyncTask<T, Void, Void> {
	public CommonTask(Context context){
		mContext = context;
		mInit = mContext.getString(R.string.get_data);
	}
	public CommonTask(Context context,String init){
		mContext = context;
		mInit = init;
	}
	@Override
	protected Void doInBackground(T... params) {
		return null;
	}

	@Override
	protected void onPostExecute(Void result) {
		mDialog.dismiss();
	}

	@Override
	protected void onPreExecute() {
		try{
			mDialog = new ProgressDialog(mContext);
			mDialog.setMessage(mInit);
			mDialog.show();
		}catch(Exception e){
			Log.e("----","-------",e);
		}
	}

	private ProgressDialog mDialog;
	private String mInit;
	protected Context mContext;
}
